<?php
//模型
class MemberTitaiModel extends MY_Model {
	function __construct(){
		parent::__construct();
		$this->table = 'user_titai';
	}
	
	function get_list($uid,$type=0){
		
		
		$sql  = "select ut.*, tc.name as position from ".$this->db->dbprefix.$this->table." as ut left join ".$this->db->dbprefix."user_titai_config as tc on ut.config_id=tc.id where ut.user_id='{$uid}' AND tc.`type` ='{$type}' ";

		$query = $this->db->query($sql);
		$res = $query->result_array();
		
		return $res;
	}
	
	function pos_get_info($uid,$type=0){
		$sql  = "select * from ".$this->db->dbprefix.$this->table." where user_id='{$uid}' AND `config_id` ='{$type}'  limit 1";

		$query = $this->db->query($sql);
		$row = $query->row_array();
		
		if(!$row){
			return false;
		}
		
		return $row;
	}
}

